package com.itheima.controller;

import com.itheima.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;

@Controller
public class IndexController {

    @GetMapping("/index")
    public String index(Model model){

        Student student = new Student();
        student.setId(123);
        student.setName("张三");
        student.setSex(0);
        List<String> hobby = new ArrayList<>();
        hobby.add("sleep");
        hobby.add("play");
        hobby.add("football");
        student.setHobby(hobby);
        //student.setHobby(Arrays.asList("sleep","play","football"));

        model.addAttribute("student", student);
        model.addAttribute("hello", "你好");
        return "index";
    }
}